<?php include './include/conf.php'; 
	$archive = $_GET["archive"];
	//Recupere les adherents qui sont archiv�s ou non
	$requete = $pdo->prepare("select * from adherent where est_archive = ?");
	$requete->execute(array($archive));
	
	$res = "";
	if($archive == 0)
	{
		if($requete->rowcount() > 0)
		{
			$res .= "<table>";
			$res .= "<thead>";
			$res .= "<tr>";
			$res .= "<th id='adherents'>Adherents</th>";
			$res .= "<th id='modifier'>Modifier</th>";
			$res .= "<th id='supprimer'>Supprimer</th>";
			$res .= "</thead>";
			$res .= "<tbody>";
			while($client = $requete->fetch())
			{
				$res .= "<tr>";
				$res .= "<td headers=".$client->nom." id=".$client->id_adherent.">".$client->prenom. " ".$client->nom."</td>";
				$res .= "<td headers='image_modif'><a href='modifier_compte_adherent.php?prenom=".$client->prenom."&nom=".$client->nom."'><img src='./photos-site/maj.jpg' alt='logo mise � jour'/></a></td>";
				$res .= "<td headers='image_supprimer'><a href='del_adherent.php?id=".$client->id_adherent."'><img src='./photos-site/supprimer.jpg' alt='logo supprimer'/></a></td>";
				$res .= "</tr>";
			}
		}
		else
		{
			$res .= "<span id='aucune_info'>Il n y a aucun adhérent actif</span>";
		}
		
	}
	else
	{
		if($requete->rowcount() > 0)
		{
			$res .= "<table>";
			$res .= "<thead>";
			$res .= "<tr>";
			$res .= "<th id='adherents'>Adherents</th>";
			$res .= "<th id='modifier'>Modifier</th>";
			$res .= "</thead>";
			$res .= "<tbody>";
			while($client = $requete->fetch())
			{
				$res .= "<tr>";
				$res .= "<td headers=".$client->nom." id=".$client->id_adherent.">".$client->prenom. " ".$client->nom."</td>";
				$res .= "<td headers='image_modif'><a href='modifier_compte_adherent.php?prenom=".$client->prenom."&nom=".$client->nom."'><img src='./photos-site/maj.jpg' alt='logo mise � jour'/></a></td>";
				$res .= "</tr>";
			
			}
			$res .= "</tbody>";
			$res .= "</table>";
		}
		else
		{
			$res .= "<span id='aucune_info'>Il n y a aucun adhérent archivé</span>";
		}
	}
	
	
	echo $res;
	
	

?>